//
//  CompoundGoodsListCell.swift
//  LeGou
//
//  Created by lxm on 2022/11/10.
//

import UIKit

class CompoundGoodsListCell: XMBaseTableViewCell {

    @IBOutlet weak var rightBtn: UIButton!
    
    @IBOutlet weak var leftBtn: UIButton!
    
    @IBOutlet weak var kucView: UIView!
    
    @IBOutlet weak var dateNum: UILabel!
    
    @IBOutlet weak var dateNumContent: UIView!

    @IBOutlet weak var name: UILabel!
    
    @IBOutlet weak var price: UILabel!
    
    @IBOutlet weak var img: UIImageView!
    
    
    
    override func awakeFromNib() {
        super.awakeFromNib()
        // Initialization code
    }
    
    override func layoutSubviews() {
        super.layoutSubviews()
        ZMUtil.clipCircle(view: dateNumContent, Corner: [.topLeft, .bottomRight], radius: 8)
    }
    
    // 0 普通, 1.无库存, 2.审核中
    func setStytle(s : Int) {
        let disableColor = "#BDBDBD".zm.hex()
        if s == 0 {
            leftBtn.layer.borderWidth = 0.5
            leftBtn.layer.borderColor = Style.mainColor.cgColor
            leftBtn.setTitleColor(Style.mainColor, for: .normal)

            rightBtn.layer.borderWidth = 0.5
            rightBtn.layer.borderColor = Style.mainColor.cgColor
            rightBtn.setTitleColor(Style.mainColor, for: .normal)

            kucView.isHidden = true
        } else if s == 1 {
            leftBtn.layer.borderWidth = 0.5
            leftBtn.layer.borderColor = Style.mainColor.cgColor
            leftBtn.setTitleColor(Style.mainColor, for: .normal)
            
            rightBtn.layer.borderWidth = 0.5
            rightBtn.layer.borderColor = disableColor.cgColor
            rightBtn.setTitleColor(disableColor, for: .normal)
            
            kucView.isHidden = false
        } else if s == 2 {
            leftBtn.layer.borderWidth = 0.5
            leftBtn.layer.borderColor = disableColor.cgColor
            leftBtn.setTitleColor(disableColor, for: .normal)
            
            rightBtn.layer.borderWidth = 0.5
            rightBtn.layer.borderColor = disableColor.cgColor
            rightBtn.setTitleColor(disableColor, for: .normal)
            kucView.isHidden = true
        }
    }
    
}
